﻿namespace EvaluationSystem.Dto
{
    public class ResultDto
    {
        public bool Suc { get; set; }
        public int Code { get; set; } = 0;
        public string? Msg { get; set; }
        public object? Data { get; set; }

        public static ResultDto Ok(string? msg = null, object? data = null)
        {
            return new ResultDto { Suc = true, Msg = msg, Data = data };
        }

        public static ResultDto Fail(int code = 1, string? msg = null, object? data = null)
        {
            return new ResultDto { Suc = true, Code = code, Msg = msg, Data = data };
        }

        public static ResultDto Error(int code = -1, string? msg = null, object? data = null)
        {
            return new ResultDto { Suc = true, Code = code, Msg = msg, Data = data };
        }
    }
}
